package thinkingJava.chapter16;

import java.util.Arrays;

public class ArrayOptions {
	public static void main(String[] args) {
		BerylliumSphere[] a;
		BerylliumSphere[] b = new BerylliumSphere[5];
		print("b : " + Arrays.toString(b));
		BerylliumSphere[] c = new BerylliumSphere[4];
		for (int i = 0 ; i < c.length ; i++) {
			if (c[i] == null) {
				c[i] = new BerylliumSphere();
			}
		}
		BerylliumSphere[] d = {new BerylliumSphere(),
				new BerylliumSphere(), new BerylliumSphere()};
		a = new BerylliumSphere[]{
				new BerylliumSphere(), new BerylliumSphere()
		};
		print("a.length : " + a.length);
		print("b.length : " + b.length);
		print("c.length : " + c.length);
		print("d.length : " + d.length);
		a = d;
		print("a.length : " + a.length);
		int[] e;
		int[] f = new int[5];
		print("f : " + Arrays.toString(f));
		int[] g = new int[4];
		for (int i = 0; i < g.length ; i++) {
			g[i] = i * i;
		}
		print("g : " + Arrays.toString(g));
		int[] h = {11,47,93};
//		print("e.length : " + e.length);
		print("f.length : " + f.length);
		print("g.length : " + g.length);
		print("h.length : " + h.length);
		e = h;
		print("e.length : " + e.length);
		e = new int[]{1,2};
		print("e.length : " + e.length);
	}
	public static void print(Object o) {
		System.out.println(o);
	}
}
